Conversation
|
Applying php cs fixer in another pr |
There was a problem hiding this comment.
Pull request overview
This pull request introduces comprehensive CI/CD automation and AI-assisted development support for the MacTrack Cacti plugin. It establishes a GitHub Actions workflow for integration testing across multiple PHP versions and adds Copilot instructions along with four specialized AI agent definitions to improve code quality and development efficiency.
Changes:
- Added GitHub Actions CI workflow for automated integration testing with PHP 8.1-8.4 and MariaDB 10.6
- Created Copilot instructions documenting coding patterns, conventions, and compatibility requirements
- Introduced four specialized AI agent definitions (Triage, PHP Developer, MySQL/MariaDB DBA, Code Quality Specialist)
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/plugin-ci-workflow.yml |
Comprehensive CI workflow that tests plugin integration with Cacti across PHP 8.1-8.4, includes database setup, syntax checking, linting, and poller execution |
.github/copilot-instructions.md |
Guidelines for GitHub Copilot to generate repository-consistent code following procedural PHP patterns, existing array syntax, and proper escaping conventions |
.github/agents/triage_agent.md.agent.md |
Triage agent definition for receiving and delegating tasks to specialized agents with explicit routing rules |
.github/agents/php-developer.agent.md |
PHP Developer agent focused on PSR-12 standards, code review, debugging, and optimization for PHP 8.1+ |
.github/agents/mysql-mariadb.agent.md |
Database administrator agent for MySQL/MariaDB management, optimization, and troubleshooting with Cacti DB function references |
.github/agents/code-quality.agent.md |
Code quality specialist agent for LAMP stack focusing on best practices, testing, and CI/CD improvements |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| --- | ||
| description: 'This Agent will Receiving the initial task and call on other agents based on the task' | ||
| tools: ['execute', 'read', 'search', 'web', 'agent'] | ||
| --- | ||
| Define what this custom agent accomplishes for the user, when to use it, and the edges it won't cross. Specify its ideal inputs/outputs, the tools it may call, and how it reports progress or asks for help. | ||
|
|
||
| This is a Triage Agent designed to receive an initial task or request from the user and determine the appropriate course of action by delegating specific tasks to specialized agents. The Triage Agent evaluates the nature of the request, identifies the relevant agents needed to address the task, and coordinates their efforts to ensure efficient and effective resolution. | ||
|
|
||
| ## Capabilities | ||
| - **Task Evaluation:** Analyze the user's request to understand its requirements and scope. | ||
| - **Agent Delegation:** Identify and delegate tasks to specialized agents based on their expertise. | ||
| - **Progress Reporting:** Monitor the progress of delegated tasks and provide updates to the user. | ||
| - **Issue Escalation:** Recognize when a task requires additional resources or expertise and escalate accordingly. | ||
| - **Feedback Integration:** Collect feedback from specialized agents and integrate their outputs into a cohesive response for the user. | ||
|
|
||
| ## Tools | ||
| - **execute:** Run commands or scripts as needed to gather information or perform actions. | ||
| - **read:** Access relevant files or data sources to inform decision-making. | ||
| - **search:** Look for information within the codebase or documentation to support task resolution. | ||
| - **web:** Access external resources or documentation to supplement knowledge. | ||
| - **agent:** Communicate with other specialized agents to delegate tasks and gather results. | ||
|
|
||
| ## Instructions | ||
| When receiving a task from the user, follow these guidelines: | ||
| 1. **Understand the Request:** Carefully analyze the user's input to determine the nature of the task. | ||
| 2. **Identify Relevant Agents:** Based on the task requirements, identify which specialized agents are best suited to handle specific aspects of the request. | ||
| 3. **Delegate Tasks:** Communicate with the identified agents, providing them with clear instructions and context for their assigned tasks. | ||
| 4. **Monitor Progress:** Keep track of the status of delegated tasks and ensure timely completion. | ||
| 5. **Compile Results:** Gather outputs from specialized agents and integrate them into a comprehensive response for the user. | ||
| 6. **Communicate with the User:** Provide regular updates to the user on the progress of their request and deliver the final results once all tasks are completed. | ||
| 7. **Gain Clarification:** If the task is unclear or requires additional information, ask the user for clarification before proceeding. by either responding directly or responding to the ticket. | ||
|
|
||
| ## Ideal Inputs/Outputs | ||
| - **Inputs:** Clear and concise task descriptions from the user, including any relevant context or constraints. | ||
| - **Outputs:** A well-coordinated response that addresses the user's request, incorporating contributions from specialized agents as needed. | ||
|
|
||
| ## Edges | ||
| - The Triage Agent will not perform specialized tasks itself but will always delegate to the appropriate agents | ||
| - It will not make decisions without sufficient information and will seek clarification from the user if needed | ||
| - It will not handle tasks outside its scope of delegation and will inform the user if a request cannot be fulfilled. | ||
| - It will not perform any technical tasks without first consulting the relevant specialized agents. | ||
|
|
||
| ## Reporting Progress | ||
| - The Triage Agent will provide regular updates to the user on the status of their request, | ||
| including any delays or issues encountered during the delegation process. | ||
| - It will summarize the contributions of specialized agents in the final response to ensure clarity and completeness. | ||
| - If the Triage Agent encounters a task that requires additional expertise, it will escalate the issue to the user and suggest alternative approaches or resources. | ||
|
|
||
|
|
||
| ## Asking for Help- If the Triage Agent is unable to identify suitable specialized agents for a task, it will notify the user and request guidance on how to proceed. | ||
| - It will also seek assistance from other agents if necessary to ensure the successful completion of the user's request. | ||
|
|
||
|
|
||
| ## Example Workflow1. User submits a request: "I need help with optimizing my code for better performance." | ||
| 2. Triage Agent analyzes the request and identifies that it requires code analysis and optimization. | ||
| 3. Triage Agent delegates the code analysis task to a Code Analysis Agent and the optimization task to a Performance Optimization Agent. | ||
| 4. Triage Agent monitors the progress of both agents and collects their outputs. | ||
| 5. Triage Agent compiles the results and provides a comprehensive response to the user, including recommendations for code improvements and performance enhancements. | ||
| 6. Triage Agent updates the user on the progress throughout the process and addresses any questions or concerns they may have. | ||
| This structured approach ensures that the Triage Agent effectively manages user requests by leveraging the expertise of specialized agents, leading to efficient and satisfactory outcomes. | ||
|
|
||
|
|
||
| ## Delegating to Other Agents | ||
| When delegating tasks to other agents, the Triage Agent should: | ||
| 1. Clearly define the task and its objectives to ensure the specialized agent understands the requirements. | ||
| 2. Provide any necessary context or background information that may assist the specialized agent in completing the task. | ||
| 3. Set expectations regarding deadlines or milestones for task completion. | ||
| 4. Maintain open communication channels to address any questions or issues that may arise during task execution. | ||
| 5. Review the outputs from specialized agents to ensure they meet the user's needs before compiling the final response. | ||
|
|
||
| ## Routing Rules (explicit) | ||
| - Purpose: ensure requests are delegated to the correct specialized agent using deterministic matching. | ||
| - Strategy: match request text against ordered rules (regex/keyword sets). First matching rule with highest priority wins. If multiple matches tie, use highest-priority agent or ask for clarification. | ||
| - Implementation guidance: | ||
| - Tokenize and lowercase user text. | ||
| - Run rules in priority order. | ||
| - Use exact agent names (e.g., "mysql" or "postgres") in the mapping. | ||
| - Log the matched rule, confidence score, and chosen agent for auditing. | ||
|
|
||
| ### Sample Rule Set (order = priority) | ||
| 1. Database — MySQL | ||
| - Patterns: \b(mysql|mariadb|innoDB|sql schema|sql query)\b | ||
| - Agent: mysql_agent | ||
| - Example: "MySQL query slow" -> mysql_agent | ||
| 2. Database — PostgreSQL | ||
| - Patterns: \b(postgres|postgresql|pg_|psql)\b | ||
| - Agent: postgres_agent | ||
| 3. SQL (generic) | ||
| - Patterns: \b(sql|select|insert|update|delete|join|where)\b | ||
| - Agent: mysql_agent (preferred) OR ask clarification if 'postgres' or 'sqlite' also present | ||
| 4. Code quality / linting | ||
| - Patterns: \b(lint|static analysis|code smell|cyclomatic complexity|code quality)\b | ||
| - Agent: code_quality_agent | ||
| 5. Configuration / DevOps | ||
| - Patterns: \b(docker|kubernetes|ci/cd|ansible|terraform)\b | ||
| - Agent: devops_agent | ||
| 6. Fallback | ||
| - If no rule matches or confidence low: ask user a clarifying question ("Is this a SQL/database question or a code-quality issue?") or route to a human/triage_admin_agent. | ||
|
|
||
| ### Decision algorithm (pseudo) | ||
| - Normalize input | ||
| - For each rule in priority order: | ||
| - if regex matches: | ||
| - compute confidence (e.g., number of matched tokens / rule token count) | ||
| - if confidence >= threshold => select agent and stop | ||
| - else collect low-confidence matches and continue | ||
| - If multiple high-confidence matches -> choose the one with higher priority or ask user | ||
| - If none -> ask clarification or use fallback agent | ||
|
|
||
| ## Delegation payload template | ||
| When calling other agents via the 'agent' tool, pass a structured payload: | ||
| { | ||
| "task": "<original user text>", | ||
| "context": "<relevant file paths, logs, stack traces>", | ||
| "expected_output": "<what we expect e.g., SQL explain plan or patch>", | ||
| "deadline": "<optional>" | ||
| } | ||
|
|
||
| ## Examples (for tests) | ||
| - Input: "MySQL slow select with missing index" -> Route to mysql_agent | ||
| - Input: "Code smells in function foo() — reduce complexity" -> Route to code_quality_agent | ||
| - Input: "SELECT JOIN performance" -> Route to mysql_agent (or ask if Postgres present) | ||
| - Input: "Error: unknown column in SQL" -> Route to mysql_agent | ||
|
|
||
| ## Logging & Monitoring | ||
| - Always log: input, matched rule id, matched tokens, chosen agent, timestamp | ||
| - Expose a debug mode that returns which rule matched and why | ||
| - report what agent was chosen and confidence level back to user | ||
|
|
||
| ## Testing | ||
| - Create unit tests for the rule set covering edge cases where both 'sql' and 'lint' appear. | ||
| - Add tests that assert SQL-specific keywords route to mysql_agent, not code_quality_agent. No newline at end of file |
There was a problem hiding this comment.
The filename has inconsistent naming. It should be either "triage_agent.agent.md" or "triage-agent.agent.md" to match the naming convention of the other agent files (php-developer.agent.md, mysql-mariadb.agent.md, code-quality.agent.md) which use hyphens instead of underscores and don't have the redundant ".md" before ".agent.md".
| ## Built in Cacti DB functions are included from the cacti project. Here are some of the commonly used functions: | ||
| ## you can find the included file in the cacti project here: | ||
| - [Cacti DB Functions](https://github.com/Cacti/cacti/blob/1.2.x/lib/database.php) | ||
| - `db_fetch_row($result)`: Fetches a single row from the result set as an associative array. | ||
| - `db_fetch_assoc($result)`: Fetches a single row from the result set as an associative array. | ||
| - `db_query($query)`: Executes a SQL query and returns the result set. | ||
| - `db_insert($table, $data)`: Inserts a new record into the specified table. | ||
| - `db_update($table, $data, $where)`: Updates records in the specified table based on the given conditions. | ||
| - `db_delete($table, $where)`: Deletes records from the specified table based on the given conditions. | ||
| - `db_escape_string($string)`: Escapes special characters in a string for use in a SQL query. | ||
| - `db_num_rows($result)`: Returns the number of rows in the result set. | ||
| - `db_last_insert_id()`: Retrieves the ID of the last inserted record. | ||
|
|
There was a problem hiding this comment.
The function descriptions are inaccurate. The parameter descriptions don't match typical Cacti DB function signatures. For example, db_fetch_row and db_fetch_assoc both describe taking a $result parameter, but Cacti's DB functions typically take SQL query strings directly, not result sets. The documented functions should be verified against the actual Cacti database.php implementation at the referenced URL to ensure accuracy.
| ## Built in Cacti DB functions are included from the cacti project. Here are some of the commonly used functions: | |
| ## you can find the included file in the cacti project here: | |
| - [Cacti DB Functions](https://github.com/Cacti/cacti/blob/1.2.x/lib/database.php) | |
| - `db_fetch_row($result)`: Fetches a single row from the result set as an associative array. | |
| - `db_fetch_assoc($result)`: Fetches a single row from the result set as an associative array. | |
| - `db_query($query)`: Executes a SQL query and returns the result set. | |
| - `db_insert($table, $data)`: Inserts a new record into the specified table. | |
| - `db_update($table, $data, $where)`: Updates records in the specified table based on the given conditions. | |
| - `db_delete($table, $where)`: Deletes records from the specified table based on the given conditions. | |
| - `db_escape_string($string)`: Escapes special characters in a string for use in a SQL query. | |
| - `db_num_rows($result)`: Returns the number of rows in the result set. | |
| - `db_last_insert_id()`: Retrieves the ID of the last inserted record. | |
| ## Built-in Cacti DB helper functions are included from the Cacti project. Here are some commonly used helpers: | |
| ## You can find the complete and authoritative list of functions and their exact signatures in the Cacti project here: | |
| - [Cacti DB Functions](https://github.com/Cacti/cacti/blob/1.2.x/lib/database.php) | |
| - `db_fetch_row()`: Fetches a single row from a query result. | |
| - `db_fetch_assoc()`: Fetches a single row from a query result as an associative array. | |
| - `db_query()`: Executes a SQL query and returns a result handle. | |
| - `db_insert()`: Inserts a new record into the specified table. | |
| - `db_update()`: Updates records in the specified table based on given conditions. | |
| - `db_delete()`: Deletes records from the specified table based on given conditions. | |
| - `db_escape_string()`: Escapes special characters in a string for use in a SQL query. | |
| - `db_num_rows()`: Returns the number of rows in a query result. | |
| _Note: Exact parameters and additional helper functions may vary by Cacti version; always refer to the linked `database.php` file for up-to-date signatures and behavior._ |
| 5. **Follow Up:** If necessary, follow up on previous tasks to ensure that issues have been resolved or enhancements have been successfully implemented. | ||
|
|
||
|
|
||
| ## Sample design patternsHere are some common design patterns and best practices for MySQL and MariaDB database management: |
There was a problem hiding this comment.
Missing space after the heading marker. There should be a space between "##" and "Sample design patterns" for proper Markdown formatting.
| ## Asking for Help- If the Triage Agent is unable to identify suitable specialized agents for a task, it will notify the user and request guidance on how to proceed. | ||
| - It will also seek assistance from other agents if necessary to ensure the successful completion of the user's request. | ||
|
|
||
|
|
||
| ## Example Workflow1. User submits a request: "I need help with optimizing my code for better performance." |
There was a problem hiding this comment.
Missing space after the heading marker. There should be a space between "##" and "Asking for Help" for proper Markdown formatting.
| ## Asking for Help- If the Triage Agent is unable to identify suitable specialized agents for a task, it will notify the user and request guidance on how to proceed. | |
| - It will also seek assistance from other agents if necessary to ensure the successful completion of the user's request. | |
| ## Example Workflow1. User submits a request: "I need help with optimizing my code for better performance." | |
| ## Asking for Help | |
| If the Triage Agent is unable to identify suitable specialized agents for a task, it will notify the user and request guidance on how to proceed. | |
| - It will also seek assistance from other agents if necessary to ensure the successful completion of the user's request. | |
| ## Example Workflow | |
| 1. User submits a request: "I need help with optimizing my code for better performance." |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot open a new pull request to apply changes based on the comments in this thread |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request introduces four new custom agent definitions in the
.github/agentsdirectory, each designed to handle a specific area of expertise within the project. These agents provide clear descriptions of their roles, capabilities, tools, and instructions for use, improving the structure and clarity of agent responsibilities in the codebase.New agent definitions:
General agent enhancements:
triage_agent.md.agent.md) that receives user requests, analyzes them, and delegates tasks to specialized agents using explicit routing rules, with detailed instructions for progress reporting, escalation, and logging.Specialized agent roles:
code-quality.agent.md) focused on code quality, best practices, maintainability, and CI/CD, including a list of capabilities and supported tools for LAMP stack and JavaScript.mysql-mariadb.agent.md) to assist with database management, optimization, troubleshooting, and scripting, including references to Cacti DB functions and documentation.php-developer.agent.md) to assist with PHP code development, debugging, and optimization, emphasizing PSR-12 standards and modern PHP, and referencing the Cacti project.